<?php
/**
 * Created by JetBrains PhpStorm.
 * User: shaoshuai
 * Date: 12-7-16
 * Time: 下午10:41
 * To change this template use File | Settings | File Templates.
 */

include 'boot.php';
session_start();

$myName = $_SESSION['username'];
$me = new User(array('name' => $myName));
$roomId = $me->getData('room');
$_SESSION['room'] = $roomId;
$room = Room::fromId($roomId);
$room->setOwner($me);
$room->save();
$_SESSION['role'] = 'owner';

$output = array(
    'success' => true,
);
echo json_encode($output);
